# -*- coding: utf-8 -*-
"""
Created on Wed Feb 20 16:45:23 2019

@author: Administrator
"""

import numpy as np
'''第一种用法'''
#a1为2*3*10
a1 = np.array([[[0,1,8,4,5,6,87,9,5,0],
               [0,1,23,4,5,6,87,9,5,123],
               [0,1,23,4,5,6,87,9,5,123]],
              [[0,0,0,0,0,0,0,0,0,0],
               [1,1,1,1,1,1,1,1,1,1,],
               [2,2,2,2,2,2,2,2,2,2,]]])

#axis=0是第一维度的比较
'''
[[0,1,8,4,5,6,87,9,5,0],
 [0,1,23,4,5,6,87,9,5,123],
 [0,1,23,4,5,6,87,9,5,123]]
与
[[0,0,0,0,0,0,0,0,0,0],
 [1,1,1,1,1,1,1,1,1,1,],
 [2,2,2,2,2,2,2,2,2,2,]]
每一个对应标号的的值进行比较。
然后返回值较大的标号，0是上面一块的，1是指下面一块的数组
'''
b1 = a1.argmax(axis=0)
print(b1)

#axis=1是第二维度的比较
'''
[0,1,8,4,5,6,87,9,5,0],
[0,1,23,4,5,6,87,9,5,123],
[0,1,23,4,5,6,87,9,5,123]
三行每一列三个数进行比较，返回较大的值的标号，0是第一行，1第二行，2是第三行
'''
b2 = a1.argmax(axis=1)
print(b2)

#axis=2是第三维度的比较
'''
[0,1,8,4,5,6,87,9,5,0]
每一行的每个数进行比较，返回较大的值的标号
'''
b3 = a1.argmax(axis=2)
print(b3)





'''第二种用法'''

#axis=0：行；axis=1：列；axis=2则为第三维
t = np.array([[1,1,1],[2,2,2],[3,3,3]]) #3*3二维矩阵
x = np.array([[2,2,2],[3,3,3],[4,4,4]])
tt = (t < x).all(axis=1)
print(tt)
#----[ True False  True]
#2*3*4矩阵
a = np.array([[[1,1,1,1],
			      [2,2,2,2],			   
               [3,3,3,3]],
			    [[2,2,2,2],
				  [3,3,3,3],
			     [4,4,4,4]]])
b = np.array([[[2,2,2,2],
			    [3,3,3,3],
			    [4,4,4,4]],
			   [[3,3,3,3],
			    [4,4,4,4],
			    [5,5,5,5]]])
ttt = (a<b).all(axis = 2)
print(ttt)
#----[[ True  True  True]
# ----[ True  True  True]]














